package app.sceledroid.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import app.sceledroid.R;
import app.sceledroid.entity.Deadline;
import app.sceledroid.entity.Forum;

public class ForumAdapter extends ArrayAdapter<Forum> {

	private ArrayList<Forum> forums;
	
	public ForumAdapter(Context context, int textViewResourceId,
			ArrayList<Forum> forums) {
		super(context, textViewResourceId, forums);
		this.forums = forums;
		// TODO Auto-generated constructor stub
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		View v = convertView;
		if (v == null) {
			Context context = super.getContext();
			LayoutInflater vi = (LayoutInflater) context
					.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			v = vi.inflate(R.layout.course_forum_item, null);
		}
		Forum f = forums.get(position);
		
		TextView forumName = (TextView)v.findViewById(R.id.forumItemName);
		forumName.setText(f.getName());
		
		
		return v;
	}
	
	

}
